(function(){
    var gallery_Items = $('.item');
    var single_Modal = $('#single-modal');
    var warp = $('#warp');
    var html = $('html');
    var body = $('body');
    var btn_Close = $('#btn-close');
    var viewer = $('#viewer');
    var modal_body = $('#modal-scroll-body');

    //modal open
    gallery_Items.on("click",function(){
        modal_Toggle();
    });

    //modal close
    btn_Close.on("click",function(){
        modal_Toggle();
        setTimeout(function(){
            viewer.toggleClass('zoomed',true);
            modal_body.scrollTop(0)
        }, 700);
    
    });
    
    function scale_Body(){
        html.toggleClass('lock-scroll');
        warp.toggleClass('scale-back');
        body.toggleClass('mask');
    }

    function modal_Toggle(){
        scale_Body();
        btn_Close.toggleClass('hide-out');
        single_Modal.toggleClass('slide-up').toggleClass('slide-down');
    }

    //viewer zoomed
    viewer.on("click",function(){
        viewer.toggleClass('zoomed');
    });

})();